import <module-name1, module-name2… >
from <modulename> import <attributename>,..
import <modulename> as <aliasname>
class Rectangle: def setdimension(self,x,y): self.length=x self.breadth=y def area(self): a=self.length*self.breadth print("Area is ",a) class Circle: def setradius(this,n): this.r=n def area(this): a=3.14*this.r**2 print("Area is ",a) def display(n): for i in range(1,n+1): print(i)
import mylib a=mylib.Circle() b=mylib.Rectangle() a.setradius(5) b.setdimension(5,10) a.area() b.area() mylib.display(5)
Area is 78.5 Area is 50 1 2 3 4 5
class Rectangle: def setdimension(self,x,y): self.length=x self.breadth=y def area(self): a=self.length*self.breadth print("Area is ",a) class Circle: def setradius(this,n): this.r=n def area(this): a=3.14*this.r**2 print("Area is ",a) def display(n): for i in range(1,n+1): print(i)
from mylib import Circle a=Circle() a.setradius(5) a.area()
Area is 78.5
class Rectangle: def setdimension(self,x,y): self.length=x self.breadth=y def area(self): a=self.length*self.breadth print("Area is ",a) class Circle: def setradius(this,n): this.r=n def area(this): a=3.14*this.r**2 print("Area is ",a) def display(n): for i in range(1,n+1): print(i)
import mylib as lib a=lib.Circle() a.setradius(5) a.area() from mylib import Rectangle as rect a=rect() a.setdimension(5,10) a.area()
Area is 78.5 Area is 50